package com.itheima.mapper;
import com.itheima.pojo.Student;
import com.itheima.pojo.StudentQueryParam;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import java.util.List;
@Mapper
public interface StudentMapper {
    List<Student> studentList (StudentQueryParam param);

    @Select("select id,name,no,gender,phone,degree,clazz_id,id_card,is_college,address,graduation_date from student")
    List<Student> list() ;

    @Insert("insert into student(name,no,gender,phone,degree,clazz_id,id_card,is_college,address,graduation_date)"+
            "values (#{name},#{no},#{gender},#{phone},#{degree},#{clazzId},#{idCard}," +
            "#{isCollege},#{address},#{graduationDate})" )
    void add(Student student);

    Student selectById(Integer id) ;
    void update(Student student);
    //删除ID数组
    void delete(List<Integer> ids);

    void deal(Integer id, Integer score);
    @Select("select count(*) from student where clazz_id = #{id}")
    Integer countClazzId(Integer id);
    @Select("select id,name,no,gender,phone,degree,clazz_id,id_card,is_college,address,graduation_date from student")
    List<Student> selectAll();
}
